package org.bright.controller;

import org.bright.entity.R;
import org.bright.service.IPurchaseSettlementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

/**
 * <p>
 * 采购结算表 前端控制器
 * </p>
 *
 * @author bright
 * @since 2024-10-21
 */
@RestController
@RequestMapping("/purchaseSettlement")
@CrossOrigin
public class PurchaseSettlementController {
    @Autowired
    private IPurchaseSettlementService purchaseSettlementService;
//查询采购结算信息
    @GetMapping("/selectPurchaseSettlementSuppliers")
    public R selectPurchaseSettlementSuppliers(@RequestParam("pageNum") int pageNum) {
        return R.success(purchaseSettlementService.selectPurchaseSettlementSuppliers(pageNum));
    }
//修改采购结算表的订单状态
    @PostMapping("/updatePurchaseSettlementStatus")
    public R updatePurchaseSettlementStatus(@RequestParam("poId") String poId,@RequestParam("supplierId") int supplierId) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException {
        return R.success(purchaseSettlementService.updateStatus(poId,supplierId));
    }
}
